import { Http } from "@/utils/request";
import { Toast } from "@/utils/toast";
import { delayTask } from "@/utils/timer";

const baseUrl = "/guide_certification";

export const index_api = (showError = true) => {
  return Http.get<{
    guider_cate: { all_count: string; items: any[] };
    guider_notice: string[];
    guider_star: string[];
    in_china: any[];
    out_china: any[];
  }>(`/v3${baseUrl}/index`).catch((error: Error) => {
    showError && delayTask(60, () => Toast.show(error.message));
    return Promise.reject(error);
  });
};

export const user_info_api = (showError = true) => {
  return Http.get<any>(`/v3${baseUrl}/user_info`).catch((error: Error) => {
    showError && delayTask(60, () => Toast.show(error.message));
    return Promise.reject(error);
  });
};
